<!-- 指定单元的全景图显示，全景图片由外部调用组件传入； -->
<template>
  <BasicModal
    v-bind="$attrs"
    @register="registerModal"
    :title="displayModuleTitle"
    width="960px"
    :minHeight="540"
    :default-fullscreen="false"
    :showCancelBtn="false"
    :showOkBtn="false"
    :footer="null"
    :centered="true"
  >
    <LiveQingPlayer :key="dataId" :src="url"></LiveQingPlayer>
  </BasicModal>
</template>
<script lang="ts">
  import { defineComponent, ref, unref, computed, onMounted, onUnmounted } from 'vue';
  import { BasicModal, useModalInner } from '/@/components/Modal';
  import LiveQingPlayer from '/@/components/QuCheng/LiveQingPlayer.vue';

  import { QcUnifyTransToChildProps } from '/#/QcUnify';
  import { displayTitle } from '/@/utils/QcUnifyUtil';
  import { useGlobSetting } from '/@/hooks/setting';
  import { getFileApi } from '/@/api/platform/file';

  export default defineComponent({
    name: 'LivePlayerModal',
    emits: ['register', 'success', 'close'],
    components: { BasicModal, LiveQingPlayer },
    setup(props, { emit }) {
      console.log('LivePlayerModal setup props', props);

      const { uploadUrl } = useGlobSetting();
      const qcUnifyProps = ref<QcUnifyTransToChildProps>();
      const url = ref<string>();
      const dataId = ref();

      let displayModuleTitle = computed(() => {
        return displayTitle(qcUnifyProps.value);
      });

      /**
       * 根据父组件传递过来的参数获取对应的操作，操作不同所对应的界面不同
       */
      const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
        if (data != undefined && data != null) {
          console.log('registerModal data', data);
          let unrefData = unref(data);
          qcUnifyProps.value = unrefData;
          dataId.value = Number.parseInt(unrefData.dataId);
          console.log('registerModal dataId.value', dataId.value);
          //测试
          // url.value = '/public/ltz.mp4';
          // console.log('getVideoFileUrl=' + getVideoFileUrl.value);
        }
      });

      onMounted(() => {
        console.log('LivePlayerModal onMounted');
      });

      onUnmounted(() => {
        console.log('LivePlayerModal onUnmounted');
      });

      return {
        displayModuleTitle,
        registerModal,
        url,
        dataId,
      };
    },
  });
</script>

<style scoped></style>
